package day_2022_12_to_3.day;

/**
 * @author haomin
 * @date 2022/12/25 12:25
 **/
public class Day12_25_Num1739 {
    class Solution {
        public int minimumBoxes(int n) {
            int cur = 1, i = 1, j = 1;
            while (n > cur) {
                n -= cur;
                i++;
                cur += i;
            }
            cur = 1;
            while (n > cur) {
                n -= cur;
                j++;
                cur++;
            }
            return (i - 1) * i / 2 + j;
        }
    }
}